package com.tanhua.dubbo.test;

import com.tanhua.domain.db.User;
import com.tanhua.dubbo.api.UserApi;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Date;

@RunWith(SpringRunner.class)
@SpringBootTest
public class testMain {

    @Autowired(required = false )
    private UserApi userApi;

    @Test
    public void testSave(){
        User user = new User();
        user.setMobile("17773898584");
        user.setPassword("1122334");
        user.setCreated(new Date());
        user.setUpdated(new Date());
        Long save = userApi.save(user);
        System.out.println("save = " + save);
    }

    @Test
    public void testSelectByMoblie(){
        User byMobile = userApi.findByMobile("18773748584");
        System.out.println("byMobile = " + byMobile);
    }
}
